package com.example.demo.service.impl;

import com.example.demo.configuration.config.RabbitMQConfig;
import com.example.demo.entity.TestUser;
import com.example.demo.mapper.TestUserMapper;
import com.example.demo.service.TestUserService;
import jakarta.annotation.Resource;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TestUserServiceImpl implements TestUserService {

    @Autowired
    private RabbitTemplate rabbitTemplate;



    @Override
    public void sendRabbitMq(String exchange, String routingKey, String msg) {
        try {
            Message message = MessageBuilder.withBody(msg.getBytes()).build();
            rabbitTemplate.send(exchange, routingKey, message);
        }catch (Exception e){
            System.out.println(e);
        }

    }

/*
    @Resource
    private TestUserMapper testUserMapper;

    @Override
    public TestUser getTestUser (Integer id){

        return new TestUser();
    }
*/

}
